package com.exam.serviceimpl;

import com.exam.entity.Student;
import com.exam.mapper.StudentMapper;
import com.exam.service.StudentService;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class StudentServiceImpl implements StudentService {
    @Autowired
    private StudentMapper studentMapper;


    @Override
    public Page<Student> findAll(Integer pagenum, Integer size) {
        PageHelper.startPage(pagenum,size);
        Page<Student> page=this.studentMapper.findAll(pagenum, size);

        return page;
    }

    @Override
    public Student findById(Integer studentId) {
        return studentMapper.findById(studentId);
    }

    @Override
    public Boolean deleteById(Integer studentId) {
        this.studentMapper.deleteById(studentId);
        return  true;
    }

    @Override
    public Boolean update(Student student) {
        this.studentMapper.update(student);
        return true;
    }

    @Override
    public Boolean updatePwd(Student student) {
        this.studentMapper.updatePwd(student);
        return true;
    }

    @Override
    public Boolean add(Student student) {
        this.studentMapper.add(student);
        return true;
    }
}
